Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the release script to change how preview releases work and adds support for manually specifying version numbers.
Key Changes:
- Preview releases now maintain the current version and add a prerelease suffix (e.g.,
11.0.0 -> 11.0.0-preview.1) instead of bumping the minor version - Added support for manually specifying versions when creating preview releases via an optional third argument
- Updated the
updateChangelogfunction to accept areleaseTypeparameter for more accurate prerelease detection
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/release.mjs | Updated preview release logic to not auto-bump version, added manual version specification feature with validation, updated documentation and error messages |
| package.json | Version bumped from 11.1.0-preview.1 to 12.0.0 |
| async function updateChangelog(version, releaseType) { | ||
| const CHANGELOG = "CHANGELOG.md"; | ||
| const isPrerelease = version.includes("-"); | ||
| const isPrerelease = releaseType === "preview" || version.includes("-"); |
There was a problem hiding this comment.
The prerelease detection logic may incorrectly classify releases when using manual versions. If a user provides pnpm release preview 12.0.0 (without prerelease suffix), the changelog will be skipped because releaseType === "preview", even though the version format indicates a stable release.
Consider determining prerelease status solely from the version format: const isPrerelease = version.includes("-"); or add validation to ensure manual versions for "preview" release type must contain a prerelease suffix.
| const isPrerelease = releaseType === "preview" || version.includes("-"); | |
| const isPrerelease = version.includes("-"); |
| // Validate manual version if provided | ||
| if (manualVersion) { | ||
| if (releaseType !== "preview") { | ||
| console.error( | ||
| "Error: Manual version can only be specified with 'preview' release type.", | ||
| ); | ||
| process.exit(1); | ||
| } | ||
| // Validate format | ||
| try { | ||
| parseVersion(manualVersion); | ||
| } catch { | ||
| console.error(`Error: Invalid version format: ${manualVersion}`); | ||
| console.error( | ||
| "Expected format: X.Y.Z or X.Y.Z-prerelease.N (e.g., 12.0.0-preview.1)", | ||
| ); | ||
| process.exit(1); | ||
| } | ||
| } |
There was a problem hiding this comment.
The manual version validation doesn't enforce that manual versions provided with releaseType === "preview" must actually be prerelease versions. This allows users to specify stable versions like 12.0.0 with the preview release type, which could lead to confusing behavior.
Consider adding a check after parseVersion(manualVersion) to ensure the version contains a prerelease suffix:
const parsed = parseVersion(manualVersion);
if (!parsed.prerelease) {
console.error("Error: Manual version for preview releases must include a prerelease suffix (e.g., 12.0.0-preview.1)");
process.exit(1);
}
No description provided.